import sys
try:
    import pygtk
    pygtk.require("2.0")
except:
    pass
try:
    import gtk
    import gtk.glade
except:
    sys.exit(1)


def show_error_dlg(error_string):
    """This Function is used to show an error dialog when
    an error occurs.
    error_string - The error string that will be displayed
    on the dialog.
    """
    error_dlg = gtk.MessageDialog(type=gtk.MESSAGE_ERROR
                                  , message_format=error_string
                                  , buttons=gtk.BUTTONS_OK)
    error_dlg.run()
    error_dlg.destroy()


def yes_no_dlg(question_string):
    """This Function is used to alert the user about possible mistakes
    
    question_string - The alert string that will be displayed on the
    dialog.
    """
    q_dlg = gtk.MessageDialog(type=gtk.MESSAGE_QUESTION
                              , message_format=question_string
                              , buttons=gtk.BUTTONS_YES_NO)
    result = q_dlg.run()
    q_dlg.destroy()
    return result
